package com.mmy.dao.car;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.mmy.domain.car.VCarOrder;

public interface VCarOrderRepository extends JpaRepository<VCarOrder, Integer> {

	/*
	 * 根据ScenicID查找
	 */
	@Query(value = "select *  from vCarOrder where left (cOrderID,8) = :iCarID", nativeQuery = true)
	List<VCarOrder> findByCarID(@Param("iCarID") int iCarID);

	/*
	 * 根据出纳审核状态查找
	 */
	@Query(value = "select *  from vCarOrder where iCashierState = :strCashierState and left (cOrderID,6) = :iCarID", nativeQuery = true)
	List<VCarOrder> findByCashierAndCarID(@Param("strCashierState") String strCashierState,
			@Param("iCarID") int iCarID);

	/*
	 * 根据会计审核状态查找
	 */
	@Query(value = "select *  from vCarOrder where iAccountState = :strAccountState and left (cOrderID,6) = :iCarID", nativeQuery = true)
	List<VCarOrder> findByAccountAndCarID(@Param("strAccountState") String strAccountState,
			@Param("iCarID") int iCarID);

}
